/*
 * berkeley.h
 *
 *  Created on: Sep 6, 2008
 *      Author: pierre
 */

#ifndef BERKELEY_HEADER
#define BERKELEY_HEADER

#include <stdio.h>
#include <db.h>
#ifdef  __cplusplus
extern "C" {
#endif

/** map flag to string */


/**
 * structure shuttle
 * used to pass parameters to any
 * program needing to open berkeley
 * environement.
 *
 */
typedef    struct DBEnvInitParams_t
{
char* error_prefix;
char* homeDir;
char* logDir;
char* dataDir;
char* tmpDir;
u_int32_t gbytes;
u_int32_t bytes;
int ncache;
u_int32_t create_flags;
u_int32_t set_flags;
u_int32_t unset_flags;
u_int32_t open_flags;
FILE* error_stream;
int open_mode;
}DBEnvInitParams,*DBEnvInitParamsPtr;

extern DBEnvInitParamsPtr DBEnv_readConfigFile(const char* xmlFile);
extern void DBEnv_free(DBEnvInitParamsPtr ptr);

#ifndef NDEBUG
	#define DBDEBUG(err) fprintf(stderr,"%s:%d \"%s\""\n",__FILE__,__LINE__,db_strerror(err))
#endif

#ifdef NDEBUG
	#define DBDEBUG(err) ((void)0)
#endif


#ifdef  __cplusplus
}
#endif

#endif /* DEBUG_H_ */
